package com.wang.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wang.entity.Student;
import com.wang.mapper.StudentMapper;
import com.wang.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Classname StudentServiceImpl
 * @Description TODO
 * @Date 2024/5/15 11:12
 * @Created by pc
 */
@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    private StudentMapper studentMapper;
    @Override
    public List<Student> getAll(Integer pageNum,Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Student> all = studentMapper.getAll();
        PageInfo<Student> pageInfo = new PageInfo<>(all);
        return pageInfo.getList();
    }

    @Override
    public Student getById(int id) {
        return studentMapper.getById(id);
    }
}
